#ifndef MY_DEFINE_H
#define MY_DEFINE_H
#include <stdint.h>

#define PRINTF_INFO_EN

typedef enum state_ebox
{
    STATE_RUNNING,
    STATE_SETTING,
} state_e;
typedef enum sensor_select_ebox
{
    SENSOR_DS18B20,
    SENSOR_Kcouple_KCouple,
    SENSOR_ADC_PT100,
} sensor_select_t;
typedef enum control_ebox
{
    CONTROL_IDLE,
    CONTROL_HUMIDITY_RUNNING,
    CONTROL_HUMIDITY_IDLE,
    CONTROL_FANS_RUNNING,
    CONTROL_FANS_IDLE,
} control_e;
typedef struct machine_sbox
{
    volatile uint32_t tick_1us;

    state_e         state;
    sensor_select_t threshold_select;
    // sensor 1
    uint8_t       ds18b20_id[8];
    char          ds18b20_box[8];
    char          ds18b20_str[20];
    float         ds18b20_temperature;
    float         ds18b20_threshold;
    char          ds18b20_threshold_str[20];
    unsigned char c1;
    unsigned char c2;
    //  sensor 2
    // uint16_t Kcouple_reg_bin;
    float         Kcouple_temperature;
    char          Kcouple_str[20];
    float         Kcouple_threshold;
    unsigned char Kcouple_threshold_str[20];
    // sensor 3
    unsigned int pt100_adc_value;
    unsigned int pt100_adc_queue[20];
    unsigned int pt100_adc_sum;
    float        pt100_adc_avg;
    float        pt100_oumu;
    float        pt100_temperature;
    char         pt100_str[20];
    float        pt100_threshold;
    char         pt100_threshold_str[20];
    //
    char wrarning_flag;
    char contral_up_flag;
    char contral_down_flag;

} machine_t;

extern machine_t machine;
extern void      safe_printf(const char* fmt, ...);

#endif
